package com.linjuke.mayouting.web.modules.action.biz;

import com.linjuke.mayouting.biz.ao.biz.BarCodeAO;
import com.linjuke.mayouting.web.common.BaseAction;
import com.zjuh.splist.core.annotation.DefaultTarget;
import com.zjuh.splist.core.form.Form;
import com.zjuh.splist.web.RunData;
import com.zjuh.splist.web.TemplateContext;
import com.zjuh.sweet.result.Result;

public class BarCodeAction extends BaseAction {

	private BarCodeAO barCodeAO;
	
	@DefaultTarget("biz/barcode/create")
	public void doCreate(RunData rundata, TemplateContext templateContext) {
		if (!checkCsrf(templateContext, "createBarCode")) {
			return;
		}
		final Form form = rundata.getForm("barcode.create");
		if (!form.validate()) {
			return;
		}
		String message = rundata.getQueryString().getString("message");
		Result result = barCodeAO.genBarCode(message);
		this.handleResult(result, rundata, templateContext);
	}

	public void setBarCodeAO(BarCodeAO barCodeAO) {
		this.barCodeAO = barCodeAO;
	}
	
}
